卷积神经网络反向传播推导
查看之前文章请点击右上角,关注并且查看历史消息,还可以在文章最后评论留言。谢谢您的支持!
Disclaimer: It is assumed that the reader is familiar with terms such as Multilayer Perceptron, delta errors or backpropagation. If not, it is recommended to read for example a of free online book ‘Neural Networks and Deep Learning’ by .
Convolutional Neural Networks (CNN) are now a standard way of image classification – there are publicly accessible deep learning frameworks, trained models and services. It’s more time consuming to install stuff like than to perform state-of-the-art object classification or detection. We also have many methods of getting knowledge -there is a large number of /, or even direct ways of accessing to the strongest Deep/Machine Learning minds such as , or by Quora, Facebook or G+.
Nevertheless, when I wanted to get deeper insight in CNN, I could not find a “CNN backpropagation for dummies”. Notoriously I met with statements like: “If you understand backpropagation in standard neural networks, there should not be a problem with understanding it in CNN” or “All things are nearly the same, except matrix multiplications are replaced by convolutions”. And of course I saw tons of ready equations.
It was a little consoling, when I found out that I am not alone, for example:
The answer on above question, that concerns the need of rotation on weights in gradient computing, will be a result of this long post.
We start from multilayer perceptron and counting delta errors on fingers:
We see on above picture that
But how do we connect concept of MLP with Convolutional Neural Network? Let’s play with MLP:
Now we can come back to gradient computing by counting on fingers, but from now we will be only focused on CNN. Let’s begin:
Yeah, it is a bit different convolution than in previous (forward) case. There we did so called valid convolution, while here we do a full convolution (more about nomenclature ). What is more, we rotate our kernel by 180 degrees. But still, we are talking about convolution!
Now, I have some good news and some bad news:
you see (BTW, sorry for pictures aesthetics :) ), that matrix dot products are replaced by convolution operations both in feed forward and backpropagation.
you know that seeing something and understanding something … yup, we are going now to get our hands dirty and prove above statement <fn> before getting next, I recommend to read, mentioned already in the disclaimer, of M. Nielsen book. I tried to make all quantities to be consistent with work of Michael.
In the standard MLP, we can define an error of neuron j as:
where
and for clarity,
But here, we do not have MLP but CNN and matrix multiplications are replaced by convolutions as we discussed before. So instead of
Above equation is just a convolution operation during feedforward phase illustrated in the above picture titled
Now we can get to the point and answer the question
We start from statement:
We know that
First term is replaced by definition of error, while second has become large because we put it here expression on
If
OK, our last equation is just …
Where is the rotation of weights? Actually
So the answer on question is simple: the rotation of the weights just results from derivation of delta error in Convolution Neural Network.
OK, we are really close to the end. One more ingredient of backpropagation algorithm is update of weights
So paraphrasing for CNN:
Input x: set the corresponding activation
for the input layer. Feedforward: for each l = 2,3, …,L compute and
Output error
: Compute the vector Backpropagate the error: For each l=L-1,L-2,…,2 compute
Output: The gradient of the cost function is given by
【过往文章】
8.朴素贝叶斯模型(NBM)详解与在Matlab和Python里的具体应用
14.【扎实资料干货分享】Python、研究报告、计量经济学、投资书籍、R语言等!(Book+Video)
16.量化投资修行之路
17.统计套利在股指期货跨期套利中的应用:基于协整方法的估计
18.股指期货跨品种套利交易
量化投资与机器学习
知识、能力、深度、专业
勤奋、天赋、耐得住寂寞